<?php

namespace App\Http\Middleware;

use Closure;
use Route;
use Auth;
class CheckLogin
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $user = Auth::guard('home')->user();
        if(empty($user) == true){
            $data = array(
                'errorMessage' => '尚未登录！',
                'success'      => false,
            );
            return response() -> json($data);exit;
        }
        return $next($request);

    }
}
